package com.cssw.fyzb.core.dao.acct;

import com.cssw.fyzb.core.model.dodb.*;
import com.ydn.dbframe.plugin.activerecord.Page;

import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * @Author zhouxu
 * @create 2020-12-24 15:24
 */
public interface RedPackDao {

    Long saveLiveRedPack(Long userId, Long liveId, Integer num, BigDecimal money, String title, String effTime) throws ParseException;

    void batchLiveRedPackSub(List<CmfLiveRedPackSub> subList);

    Long savePersonRedPack(Long userId, Long otherId, BigDecimal money, String title);

    RedPackPerson getPerRedPack(Long redPackId);

    void updatePerRedPackStatus(RedPackPerson pack, String status);

    CmfLiveRedPack getLiveRedPack(Long redPackId);

    void updateLiveRedPackStatus(CmfLiveRedPack pack, String status);

    CmfLiveRedPackSub findFirstByStatus(Long redPackId, String status);

    void takeLiveRedPackSub(CmfLiveRedPackSub sub, Long userId);

    Page<RedPackLog> listLog(Integer page, Integer limit, Map<String, Object> param);

    Long addRedPackLog(Long userId, String packType, String changeType, BigDecimal money, String tradeId, String tradeType, String tradeName);

    void updateLiveRedPackSurplus(CmfLiveRedPack pack, BigDecimal surplus);

    CmfLiveRedPack queryLatestLivePack(Long liveId);

    //私人红包
    List<RedPackPerson> listRedPackRerson();

    //日志添加
    Long saveRedPackLog(Long userId, String packType, String changeType, BigDecimal money, String tradeId,
                        String tradeType, String tradeTName);

    //主播红包
    List<CmfLiveRedPack> listCmfLiveRedPack();

    //修改私人红包状态
    void updateStatus(Long redPackId, String status);

    //修改直播红包状态
    void updateLiveStatus(Long redPackId, String status);

    //查询私人红包详情
    RedPackPerson getRedPackPerson(Long redId, String tradeType);

    //查询直播红包详情
    CmfLiveRedPack getCmfLiveRedPack(Long redId, String tradeType);

    //查询领取人
    List<CmfLiveRedPackSub> listUser(Long redId);

    //根据用户id和时间判断红包是否是当场直播的红包
    CmfLiveRedPack getLiveRed(Long uid);
}
